﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable disable

namespace My.FrameWork.Models
{
    public partial class MyContext : DbContext
    {
        //public MyContext()
        //{
        //}

        public MyContext(DbContextOptions<MyContext> options)
            : base(options)
        {
        }

        public virtual DbSet<DV_B_PermissionMenu> DV_B_PermissionMenus { get; set; }
        public virtual DbSet<DV_B_PermissionSetting> DV_B_PermissionSettings { get; set; }
        public virtual DbSet<DV_B_Role> DV_B_Roles { get; set; }
        public virtual DbSet<DV_B_RoleSubTable> DV_B_RoleSubTables { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseSqlServer("server=139.199.213.110;uid=sa;pwd=Hn#kdskd83nh110#JW;database=EIC;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("Relational:Collation", "Chinese_PRC_CI_AS");

            modelBuilder.Entity<DV_B_PermissionMenu>(entity =>
            {
                entity.HasKey(e => e.PermissionMenuID)
                    .HasName("PK_DV_PermissionMenu");

                entity.ToTable("DV_B_PermissionMenu");

                entity.Property(e => e.PermissionMenuID).HasMaxLength(36);

                entity.Property(e => e.MenuField)
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.MenuIcon)
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.MenuName).HasMaxLength(50);

                entity.Property(e => e.MenuSort)
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.MenuType)
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.Property(e => e.MenuUrl)
                    .HasMaxLength(200)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<DV_B_PermissionSetting>(entity =>
            {
                entity.HasKey(e => e.PermissionSettingsID)
                    .HasName("PK_DV_PERMISSIONSETTINGS");

                entity.Property(e => e.PermissionSettingsID).HasMaxLength(36);

                entity.Property(e => e.CreateTime).HasColumnType("datetime");

                entity.Property(e => e.CreatorCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.CreatorName).HasMaxLength(50);

                entity.Property(e => e.PermissionMenuField).HasMaxLength(100);

                entity.Property(e => e.PermissionMenuID).HasMaxLength(36);

                entity.Property(e => e.PermissionMenuType).HasMaxLength(10);

                entity.Property(e => e.RoleID).HasMaxLength(36);

                entity.Property(e => e.RoleName).HasMaxLength(100);

                entity.Property(e => e.UpdateCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateName).HasMaxLength(50);

                entity.Property(e => e.UpdateTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<DV_B_Role>(entity =>
            {
                entity.HasKey(e => e.RoleID)
                    .HasName("PK_DV_ROLESETTINGS");

                entity.ToTable("DV_B_Role");

                entity.Property(e => e.RoleID).HasMaxLength(36);

                entity.Property(e => e.CreateTime).HasColumnType("datetime");

                entity.Property(e => e.CreatorCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.CreatorName).HasMaxLength(50);

                entity.Property(e => e.Demonstrate).HasMaxLength(500);

                entity.Property(e => e.RoleName).HasMaxLength(50);

                entity.Property(e => e.UpdateCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateName).HasMaxLength(50);

                entity.Property(e => e.UpdateTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<DV_B_RoleSubTable>(entity =>
            {
                entity.HasKey(e => e.RoleSubTableID)
                    .HasName("PK_DV_RoleSettingsSubTable");

                entity.ToTable("DV_B_RoleSubTable");

                entity.Property(e => e.RoleSubTableID).HasMaxLength(36);

                entity.Property(e => e.CreateTime).HasColumnType("datetime");

                entity.Property(e => e.CreatorCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.CreatorName).HasMaxLength(50);

                entity.Property(e => e.DefaultRole)
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.RoleID)
                    .IsRequired()
                    .HasMaxLength(36);

                entity.Property(e => e.UpdateCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateName).HasMaxLength(50);

                entity.Property(e => e.UpdateTime).HasColumnType("datetime");

                entity.Property(e => e.UserCardNumber)
                    .HasMaxLength(30)
                    .IsUnicode(false);

                entity.Property(e => e.UserName).HasMaxLength(50);
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
